package com.lu.dao.ds1;


import com.lu.model.Message;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class MessageDao {


    @Resource
    private SessionFactory sessionFactory;

    public void save(Message message) {
        Session session = sessionFactory.getCurrentSession();
        session.save(message);
    }

    public Message get(Long id) {
        Session session = sessionFactory.getCurrentSession();
        Message message = session.get(Message.class, id);
        return message;
    }
}
